<?php 
	$title = $_GET['s'];
	$db = new DBManager ( 'localhost', 'root', '', 'iumus' );
	$query = "SELECT id, title, year, genre, cover FROM movie WHERE title LIKE '%".$title."%'";

	$result = $db->executeQuery ( $query );
	echo '<table>';
	echo '<tr><th colspan="3">Search result for &quot;'.$title.'&quot;&nbsp; (<a href="javascript:showAdvancedSearch()">Advanced Search</a>)</th></tr>';
	
	echo '<tr><td colspan="3">';
	echo '<div id="advanced" style="display: none">';
	include 'support/AdvancedSearch.html';
	echo '</div>';
	echo '</td></tr>';
	
	while ( $row = mysql_fetch_array ( $result ) ) {
		echo '<tr>';
		echo '	<td>';
		if ( $row['cover'] == 'N/A' ) $row['cover'] = 'wp-content/themes/theme1273/images/noCover.png';
		echo '		<a href="infoFilm.php?id='.$row['id'].'">';
		echo '		<img src="'.$row['cover'].'" style="width: 43px; height: 65px"/>';
		echo '		</a>';
		echo '	</td>';
		echo '	<td>';
		echo '		<a  style="font-size: 13px; color: #FF5000; font-weight: bold;" href="infoFilm.php?id='.$row['id'].'">';
		echo '		'.$row['title'].' </a></br>'.$row['genre'].'';
		//echo '		</a>';
		echo '	</td>';
		echo '	<td>';
		echo '		'.$row['year'];
		echo '	</td>';
		echo '</tr>';
	}
	
	echo '</table>';
?>

<script type="text/javascript">

var ad = 'hide';

function showAdvancedSearch() {
	if ( ad == 'hide' ) { $( '#advanced' ).show ( 'slow' ); ad = 'show'; }
	else { $( '#advanced' ).hide ( 'slow' ); ad = 'hide'; }
}

</script>